package com.example.springtest;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/**
 * @Author: HuoYongZhuang
 * @create 2022/11/11
 */

@Slf4j
@Component
public class Component2 {

    @Autowired
    private ApplicationContext context;


    public void register(){
        System.out.println("用户注册");
        context.publishEvent(new UserRegisteredEvent(this));
    }


}
